package cn.laixueit.service.impl;

import cn.laixueit.mapper.SpecParamMapper;
import cn.laixueit.pojo.SpecParam;
import cn.laixueit.service.SpecParamService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class SpecParamServiceImpl extends ServiceImpl<SpecParamMapper, SpecParam> implements SpecParamService {
    @Override
    public List<SpecParam> specParamsByGid(Long gid,Long cid,Boolean searching,Boolean generic) {
        HashMap<String, Object> map = new HashMap<>();
        if(gid != null){
            map.put("group_id",gid);
        }
        if(cid != null){
            map.put("cid",cid);
        }
        if(searching != null){
            map.put("searching",searching);
        }
        if(generic != null){
            map.put("generic",generic);
        }
        List<SpecParam> specParamList = listByMap(map).stream().collect(Collectors.toList());
        return specParamList;
    }
}
